/**
 * Activity principal do sistema
 */
package br.com.rafsoft.mapaentrega.activity;

import br.com.rafsoft.mapaentrega.MapaEntregaApplication;
import br.com.rafsoft.mapaentrega.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

/**
 * @author Rafael
 *
 */
public class MainActivity extends Activity {
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
        setContentView(R.layout.main); 
        
        MapaEntregaApplication application = (MapaEntregaApplication) getApplication();
        
        //busca os componentes     
        final TextView user = (TextView) findViewById(R.id.textViewMainName);
        user.setText(application.getUserName());
        final ImageView imageViewTasks = (ImageView) findViewById(R.id.imageViewTasks);
        final ImageView imageViewMessages = (ImageView) findViewById(R.id.imageViewMessages);
        
        
        //informa o listener
        imageViewTasks.setOnClickListener(new ImageView.OnClickListener() {			
			public void onClick(View v) {
				Intent it = new Intent(MainActivity.this, TaskListActivity.class);
				startActivity(it);
			}
		});
        
        imageViewMessages.setOnClickListener(new ImageView.OnClickListener() {			
			public void onClick(View v) {
				Intent it = new Intent(MainActivity.this, MessageListActivity.class);
				startActivity(it);
			}
		});
       
	}
}
